import {HttpClient} from '@angular/common/http';
import {Injectable} from '@angular/core';

import {Observable} from "rxjs/Observable";
import 'rxjs/add/operator/map';
import {ParamModel} from "../../../model/pages/client/extension-edit/extension-edit.model";

@Injectable()
export class ExtensionEidtProvider {

    constructor(public http: HttpClient) {
    }

    // 获取扩展字段
    // 更新核心客户扩展字段
    updateExtensionCustomer(customerData: ParamModel): Observable<any> {
        return this.http.put(`/party/v1/detail/`, customerData, {responseType: "text"});
      //  return this.http.put(`http://10.248.37.62:8099/party/v1/detail/`, customerData, {responseType: "text"});
    }

    // 首次保存核心客户扩展字段
    addExtensionCustomer(customerData: ParamModel): Observable<any> {
        console.log(3);
    //    return this.http.post(`/party/v1/customer`, customerData, {responseType: "text"});
      return this.http.post(`/party/v1/customer`, customerData, {responseType: "text"});
    }

    // 删除地址电话号码
    delPhone(id): Observable<any> {
        return this.http.delete(`/leads/v1/contact/${id}`, {responseType: "text"});
       // return this.http.delete(`http://10.248.37.62:8065/leads/v1/contact/${id}`, {responseType: "text"});
    }
}
